package com.zx.mes.hyl.autoconfigure;

import com.zx.mes.hyl.advice.ExceptionControllerAdvice;
import com.zx.mes.hyl.config.MybatisPlusConfig;
import com.zx.mes.hyl.controller.BaseControllerExt;
import com.zx.mes.hyl.strategy.IKeyGenerateStrategy;
import com.zx.mes.hyl.strategy.impl.DefaultKeyGenerateStrategyImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * rest,exception advice autoconfigure
 *
 * @author 华云龙
 * @date 2018-11-6
 */
@Configuration
@Import({MybatisPlusConfig.class, ExceptionControllerAdvice.class, BaseControllerExt.class})
public class RestAutoConfig {

    /**
     * UUID生成策略配置
     *
     * @return com.zx.mes.hyl.strategy.KeyGenerateStrategy
     */
    @ConditionalOnMissingBean
    @Bean
    public IKeyGenerateStrategy keyGenerateStrategy() {
        return new DefaultKeyGenerateStrategyImpl();
    }
}
